package API.PackagingClass.Integer;

public class DecimalConversion {
    public static void main(String[] args) {
        System.out.println(myConversion(255, 16));
    }

    public static String myConversion(int num, int how) {
        if (num == 0)
            return "0";
        StringBuilder sb = new StringBuilder();
        while (num != 0) {
            int remainder = num % how;
            if (remainder >= 10) {
                sb.append((char)('A' + remainder - 10));
            } else {
                sb.append((char)((num % how) + '0'));
            }
            num /= how;
        }
        sb.reverse();
        return sb.toString();
    }
}
